package database.access.layer;

import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;

import domain.Preference;

public class PreferenceDal {
	protected ConnectionManager mgr = null;
	protected Connection con = null;
	
	public PreferenceDal(){
	}
	

	public void savePreference(Preference preference) throws SQLException{
		this.mgr = ConnectionManager.getInstance();
		this.con = mgr.getConnection();
		Statement st = con.createStatement() ;
		st.executeUpdate("insert into PREFERENCE (userId, movieId , value)" +
				"values ("+ preference.getUserId() + ", '" + preference.getMovieId() + "', '"+preference.getValue()+"')");
		st.close();
		mgr.closeConnection(con);
	}
	
}
